﻿using System;
using SilverChart.Core.Service;

namespace SilverChart.Core.Configuration.Converter {
    [ServiceProvider(LayzeCreation = true, ServiceName = "Default Int32 configuration converter", Singleton = true)]
    public class Int32Converter : ConfigurationConverter<Int32> {
        #region ConfigurationConverter<int> Members
        public bool Convert(String itemValue, out int value) {
            if (itemValue == null || !Int32.TryParse(itemValue, out value)) {
                value = 0;
                return false;
            }
            return true;
        }
        #endregion
    }
}
